<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改页面</title>
    <script src="js/axios.min.js"></script>
    <script src="js/jquery-1.11.3.min.js"></script>
    <script src="js/vue.js"></script>
    <script src="layui/layui.js"></script>
    <script src="js/vue-router.js"></script>
    <link rel="stylesheet" href="layui/css/layui.css"/>
    <link rel="stylesheet" href="css/goods.css"/>
    <link rel="stylesheet" href="/static/build/layui.css" media="all">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body>
<div id="app">
    <blockquote class="layui-elem-quote">输入用户信息</blockquote>
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label" >用户名</label>
            <div class="layui-input-block">
                <input type="text" id="username" name="title" v-model="username" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" >密码</label>
            <div class="layui-input-block">
                <input type="text" id="password" name="username" v-model="password" lay-verify="required" lay-reqtext="店铺编号是必填项，岂能为空？" placeholder="请输入" autocomplete="off" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" >性别</label>
            <div class="layui-input-block">
                <input type="text" name="username" id="gender" v-model="gender" lay-verify="required" lay-reqtext="店铺编号是必填项，岂能为空？" placeholder="请输入" autocomplete="off" class="layui-input" >
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">用户手机号</label>
            <div class="layui-input-block">
                <input type="text" id="tele" name="title" v-model="tele" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input" >
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">用户年龄</label>
            <div class="layui-input-block">
                <input type="text" id="age" name="title" v-model="age"lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input" >
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">用户地址</label>
            <div class="layui-input-block">
                <input type="text"  id="address" name="title"  v-model="address" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="" class="layui-btn"  @click="update">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<script src="js/usermodify.js"></script>
<script>
    layui.use(['form', 'upload'], function(){
        var form = layui.form;

        form.render();  // 加入这一句
    });
</script>

<script>

    let id = localStorage.getItem("user_id");
    function updateinfo(){
        let password = document.getElementById("password").value;
        let username = document.getElementById("username").value;
        let gender = document.getElementById("gender").value;
        let tele = document.getElementById("tele").value;
        let address = document.getElementById("address").value;
        let age = document.getElementById("age").value;
        $.get("http://47.94.138.204:7790/example/updateUser", { id: id, password: password, username: username, gender: gender, tele: tele, address: address,  age: age},
            function(data){
                if(data == 1){
                    alert("修改成功");
                }else{
                    alert("修改失败");
                }


            });
    }

</script>


</body>
</div>
</html>